import { Directive, ElementRef, OnInit, Input, AfterViewInit } from '@angular/core';
require('prismjs/prism.js')
require('prismjs/components/prism-json.js');
require('prismjs/plugins/line-numbers/prism-line-numbers.min.js')
declare var Prism: any;

@Directive({
    selector: '[witCode]',

})
export class WitCodeHighlighter implements OnInit, AfterViewInit {
    @Input() codeType: string;
    constructor(private el: ElementRef) { }
    ngOnInit() {
        // Prism.highlightAll();
        this.el.nativeElement.className = 'language-' + this.codeType;
    }
    ngAfterViewInit() {
        Prism.highlightElement(this.el.nativeElement);
    }
}